package com.james.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @ClassName: EurekaWebSecurityConfig
 * @Author: JamesWang
 * @Date: 2021/4/18 15:11
 * @Description:
 * @Version:1.0
 */
@Configuration
public class EurekaWebSecurityConfig extends WebSecurityConfigurerAdapter {
    /**
     * 配置http放行
     * @param http
     * @throws Exception
     */
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // 关闭跨站请求攻击
        http.csrf().disable();
        // 放行健康检查的端口
        http.authorizeRequests().antMatchers("/actuator/**").permitAll();
        super.configure(http);
    }
}
